package com.ljw.spring.annotation.bean;

import lombok.Data;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @FileName Desk
 * @Description TODO
 * @Author ljw
 * @Date 2021/2/2 0:23
 * @Version 1.0
 */
@Data
public class Desk {
    private String name;

    public Desk() {
    }

    public Desk(String name) {
        System.out.println("创建desk实例");
        this.name = name;
    }

    //创建实例对象并属性赋值后执行初始化方法
    @PostConstruct
    public void init(){
        System.out.println("初始化desk实例");
    }

    @PreDestroy //IOC容器销毁实例对象之前执行销毁方法
    public void destroy(){
        System.out.println("销毁desk实例");
    }
}
